package com.bjpowernode.springboot.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;

@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/get")
    @ResponseBody
    public HashMap<String, Object> getUser() {
        HashMap<String, Object> map = new HashMap<>();
        map.put("username","张三");
        map.put("password","root");
        return map;
    }

    @RequestMapping("/hello")
    public ModelAndView hello() {
        ModelAndView mv = new ModelAndView();
        mv.addObject("message","你好，SpringBoot");
        mv.setViewName("hello");
        return mv;
    }

}
